package com.scada.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.scada.contant.MessageConstants;
import com.scada.hessian.client.impl.MenuVisitorClient;
import com.scada.model.bean.SysMenu;
import com.scada.model.bean.vo.MenuVO;
import com.scada.model.result.ResponseBean;
import com.scada.service.MenuService;


@Service
public class MenuServiceImp implements MenuService{
	
	@Autowired
	public MenuVisitorClient menuVisitorClient;

	@Override
	public List<MenuVO> selectMenuList(int id) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("pid", id);
		map.put("state", MessageConstants.State.STATE_SHOW.getKey());
		map.put("isleaf", MessageConstants.MenuIsLeft.MenuIsLeft_1.getKey());
		return menuVisitorClient.selectMenuList(map);
	}

	@Override
	public List<SysMenu> selectMenuIsleaf() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("state", MessageConstants.State.STATE_SHOW.getKey());
		map.put("isleaf", MessageConstants.MenuIsLeft.MenuIsLeft_0.getKey());
		return menuVisitorClient.selectMenuIsleaf(map);
	}
	
	@Override
	public List<SysMenu> findLeftMenuByUser(Integer userId){
		return menuVisitorClient.findLeftMenuByUser(userId);
	}
	
	@Override
	public List<MenuVO> findLeftMenuById(Integer userId, Integer id){
		return menuVisitorClient.findLeftMenuById(userId, id);
	}

	@Override
	public List<SysMenu> selectAllData() {
		
		return menuVisitorClient.selectAllData(MessageConstants.State.STATE_DEL.getKey());
	}

	@Override
	public ResponseBean selectAllMenuAndPermission(){
		
		return menuVisitorClient.selectAllMenuAndPermission();
	}
	
}
